<extend name="Public/base"/>

<block name="body" >
    <style>
        span{
            font-size: 15px;
            font-weight: bold;
        }
        .datatext{
            margin-bottom: 40px;
        }
        ul{
            list-style: none;
        }
        .img_li{
            float: left;
            margin-left: 10px;
            width: 40px;
            height: 40px;
        }
        .img_li:hover{
            background-color:#00a2d4 ;
        }
        .img_li img{
            margin-left: 7px;
            margin-top: 6px;

        }
    </style>

    <div style="margin-left:100px; ">
        <div class="datatext" style="margin-top: 30px"><span>频道ID:</span> {$res.id}</div>
        <div class="datatext"><span>上级频道ID:</span> {$res.pid}</div>
        <div class="datatext"><span>频道标题:</span> {$res.title}</div>
        <div class="datatext"><span>选择图标:</span>  已选择第<span id="img_mum">{$res.icon}</span>张图标
            <ul>
                <li class="img_li"><a onclick="chose_img(this)"><img id="1" src="Application/Admin/Static/images/customedit/1.png" ></a></li>
                <li class="img_li"><a onclick="chose_img(this)"><img id="2" src="Application/Admin/Static/images/customedit/2.png"></a></li>
                <li class="img_li"><a onclick="chose_img(this)"><img id="3" src="Application/Admin/Static/images/customedit/3.png"></a></li>
                <li class="img_li"><a onclick="chose_img(this)"><img id="4" src="Application/Admin/Static/images/customedit/4.png"></a></li>
                <li class="img_li"><a onclick="chose_img(this)"><img id="5"src="Application/Admin/Static/images/customedit/5.png"></a></li>
                <li class="img_li"><a onclick="chose_img(this)"><img id="6"src="Application/Admin/Static/images/customedit/6.png"></a></li>
                <li class="img_li"><a onclick="chose_img(this)"><img id="7"src="Application/Admin/Static/images/customedit/7.png"></a></li>
                <li class="img_li"><a onclick="chose_img(this)"><img id="8"src="Application/Admin/Static/images/customedit/8.png"></a></li>
                <li class="img_li"><a onclick="chose_img(this)"><img id="9"src="Application/Admin/Static/images/customedit/9.png"></a></li>
                <li class="img_li"><a onclick="chose_img(this)"><img id="10"src="Application/Admin/Static/images/customedit/10.png"></a></li>
                <li class="img_li"><a onclick="chose_img(this)"><img id="11"src="Application/Admin/Static/images/customedit/11.png"></a></li>
                <li class="img_li"><a onclick="chose_img(this)"><img id="12"src="Application/Admin/Static/images/customedit/12.png"></a></li>
                <li class="img_li"><a onclick="chose_img(this)"><img id="13"src="Application/Admin/Static/images/customedit/13.png"></a></li>
                <li class="img_li"><a onclick="chose_img(this)"><img id="14"src="Application/Admin/Static/images/customedit/14.png"></a></li>
            </ul>
            <input type="hidden" value="{$res.id}" name="id">

        </div>
        <div class="datatext"><h3>说明:</h3><textarea style="height: 250px;width: 200px" name="band_text">{$res.band_text}</textarea></div>
        <div><button  style="margin-left: 40px" class="btn btn-default" data-role="editbtn">确定</button><button style="margin-left: 20px" class="btn btn-return" onclick="javascript:history.back(-1);return false;">返回</button></div>
    </div>

    <script>

        function chose_img(obj) {
            $('.img_li').css({
                'background-color':''
            });
            $(obj).parent().css({
                'background-color':'#00a2d4'
            });

            $('#img_mum').html($(obj).children().attr('id'));
        }
        $('[data-role="editbtn"]').click(function () {
            var url=U('Admin/Channel/editData');
            var text=$('[name="band_text"]').val();
            var imgid=$('#img_mum').html();
            var id=$('[name="id"]').val();
            $.post(url,{text:text,imgid:imgid,id:id},function (msg) {
                if(msg==1){
                    toast.success('编辑成功!');
                }else{
                    toast.success('编辑失败!');
                }
            })
        })
    </script>

</block>